const cardsNameMap: Map<number, string> = new Map([
	[0, "方片A"],
	[1, "梅花A"],
	[2, "红桃A"],
	[3, "黑桃A"],
	[4, "方片2"],
	[5, "梅花2"],
	[6, "红桃2"],
	[7, "黑桃2"],
	[8, "方片3"],
	[9, "梅花3"],
	[10, "红桃3"],
	[11, "黑桃3"],
	[12, "方片4"],
	[13, "梅花4"],
	[14, "红桃4"],
	[15, "黑桃4"],
	[16, "方片5"],
	[17, "梅花5"],
	[18, "红桃5"],
	[19, "黑桃5"],
	[20, "方片6"],
	[21, "梅花6"],
	[22, "红桃6"],
	[23, "黑桃6"],
	[24, "方片7"],
	[25, "梅花7"],
	[26, "红桃7"],
	[27, "黑桃7"],
	[28, "方片8"],
	[29, "梅花8"],
	[30, "红桃8"],
	[31, "黑桃8"],
	[32, "方片9"],
	[33, "梅花9"],
	[34, "红桃9"],
	[35, "黑桃9"],
	[36, "方片T"],
	[37, "梅花T"],
	[38, "红桃T"],
	[39, "黑桃T"],
	[40, "方片J"],
	[41, "梅花J"],
	[42, "红桃J"],
	[43, "黑桃J"],
	[44, "方片Q"],
	[45, "梅花Q"],
	[46, "红桃Q"],
	[47, "黑桃Q"],
	[48, "方片K"],
	[49, "梅花K"],
	[50, "红桃K"],
	[51, "黑桃K"]
])

export function getCardsName(cardsNumStr: string | null): string {
	if (!cardsNumStr) return ""

	const cardsNumReplaceStr = cardsNumStr.replace(/[[\]]/g, "")
	if (!cardsNumReplaceStr) return ""

	const cardsNumArr = cardsNumReplaceStr.split(",").map(Number)
	const cardsNameArr = cardsNumArr.map(item => cardsNameMap.get(item)).filter(cardName => cardName !== undefined) as string[]

	return cardsNameArr.join("，")
}
